home *** CD-ROM | disk | FTP | other *** search
- Path: news.interlog.com!not-for-mail
- From: monteith@interlog.com (Mike Monteith)
- Newsgroups: comp.lang.c
- Subject: HELP: Redirecting stdout problem
- Date: 17 Jan 1996 10:32:31 -0500
- Organization: Interlog Internet Services -Voice (416) 975-2655 -Data 515-1414
- Message-ID: <4dj4qf$4e9@gold.interlog.com>
- NNTP-Posting-Host: gold.interlog.com
- Summary: Problem restoring stdout to "CON"sole after child process is executed.
- Keywords: C HELP
-
- Compiler: MSVC 2.0
- Target: WIN32 Console App.
-
- Problem:
-
- The following code snippet successfully redirects stdout to the temporary
- file, but the attempt to restore stdout to the console fails. Any Ideas?
- Please reply by e-mail to monteith@interlog.com.
-
-
- Thanks in advance
-
- Mike
-
- ************* Code *****************
-
- FILE *stream;
-
- stream = freopen("TEMP.OUT", "w", stdout)
-
- _spawnvpe(_P_WAIT, ProgName, Args, Env);
-
- stream = freopen("CON", "w", stdout);
-
- Note:
-
- 1. The first freopen works fine. All of the console output from the
- spawned process is written to TEMP.OUT.
- 2. Second freopen returns NULL (failure).
-
-
-
-